// 1. 引入request
import request from '@/utils/request'

import type { CategoryListModel } from './interface/categoryModel'

// 2. 使用枚举设置接口
enum Api {
  // 获取一级导航分类
  getCategory1ListApi = '/admin/product/getCategory1',
  // 获取二级导航分类
  getCategory2ListApi = '/admin/product/getCategory2',
  // 获取三级导航分类
  getCategory3ListApi = '/admin/product/getCategory3',
  // 
}


//  4. 获取一级导航
export const reqGetCategory1List = () => {
  return request.get<any, CategoryListModel>(Api.getCategory1ListApi)
}


  // 5. 获取二级导航分类数据
export const reqGetCategory2List = (category1Id: number) => {
  return request.get<any, CategoryListModel>(Api.getCategory2ListApi + `/${category1Id}`)
}


  // 6. 获取三级导航分类数据
export const reqGetCategory3List = (category2Id: number) => {
  return request.get<any, CategoryListModel>(Api.getCategory3ListApi + `/${category2Id}`)
}